version: '2'

services:
  app:
    image: 'myapp:latest'
    build:
      context: .
    container_name: app
    ports:
      - 8080:8080
    depends_on:
      - db
    environment:
      - SPRING_DATASOURCE_URL=jdbc:postgresql://db:5432/effective
      - SPRING_DATASOURCE_USERNAME=postgres
      - SPRING_DATASOURCE_PASSWORD=testtest
      - SPRING_JPA_HIBERNATE_DDL_AUTO=create-drop

  db:
    image: 'postgres:13.1-alpine'
    container_name: db
    environment:
      - POSTGRES_DB=effective
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=testtest
    ports:
      - 5433:5432
    volumes:
      - private_db_volume:/var/lib/postgresql/data
volumes:
    private_db_volume: